import { getToken } from '@/utils';

// 存储 token 所以初始化为字符串
const initialState = getToken();
// const initialState = '';

const login = (state = initialState, action) => {
  switch (action.type) {
    case 'login/token':
      return action.payload;
    case 'login/logout':
      return initialState;
    default:
      return state;
  }
};

export default login;
